package learning.pcfg.model;

public class InnerProduction implements IProduction {

	public String group;
	public String lhs;
	public String[] rhs;
	public boolean learnable;   
	// learnable is needed, because mnf transformation creates add'l
	// prods which should not be learned
	
	InnerProduction(String group, String lhs, String[] rhs) {
		this.group = group;
		this.lhs = lhs;
		this.rhs = rhs;
		this.learnable = true;
	}

	InnerProduction(String group, String lhs, String[] rhs, boolean learnable) {
		this(group, lhs, rhs);
		this.learnable = learnable;
	}
	
	public String lhs() {
		return lhs;
	}
	
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append("{" + group + "}\t" + lhs + " ->");
		for (String r : rhs) sb.append(" " + r);
		return sb.toString();
	}
}
